# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=allegro
pkgver=5.2.9.0
pkgrel=0
arch="all"
url="https://liballeg.org"
pkgdesc="Portable library mainly aimed at video game and multimedia programming"
license="BSD-3-Clause"
makedepends="
	alsa-lib-dev
	cmake
	flac-dev
	glu-dev
	gtk+3.0-dev
	libjpeg-turbo-dev
	libtheora-dev
	libvorbis-dev
	libwebp-dev
	libxcursor-dev
	libxi-dev
	mesa-dev
	pulseaudio-dev
	samurai
	xorg-server-dev
	"
source="https://github.com/liballeg/allegro5/releases/download/$pkgver/allegro-$pkgver.tar.gz"
subpackages="$pkgname-dev"

build() {
	# sdl2 is disabled for now as it's experimental still
	# and the tests are crashing on it
	# https://github.com/liballeg/allegro5/issues/1229
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DALLEGRO_SDL=OFF \
		-DWANT_TESTS=ON \
		-DWANT_EXAMPLES=OFF \
		-DWANT_DEMO=OFF
	cmake --build build
}

check() {
	cd build
	tests/test_driver --no-display ../tests/test_*.ini
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d4e80a43b41856d1d58923f0c9b3f9ff6b05d4938e1602fc2110bf8045b63836f35cb0c0d823763a4692ba73bd51c495793e21f68965134b2b4f5a2ea2f4b633  allegro-5.2.9.0.tar.gz
"
